package com.ssm.lzh.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ssm.hj.page.Page;
import com.ssm.lzh.serachId.SerachId;
import com.ssm.lzh.service.JbkService;
import com.ssm.mapper.JbkMapper;
import com.ssm.pojo.Food;
import com.ssm.pojo.Jbk;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class JbkServiceImpl implements JbkService {

    @Resource
    private JbkMapper jbkMapper;


    @Resource
    private SerachId serachId;


    @Override
    public PageInfo<Jbk> queryAllJbk(Page<Jbk> page) {
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        return new PageInfo<Jbk>(this.jbkMapper.queryAllJbk(page.getSearchObj()));
    }

    @Override
    public int addJb(Jbk jbk) {
        String jb = serachId.ccid("JB");
        jbk.setJbid(jb);
        return this.jbkMapper.addJb(jbk);
    }

    @Override
    public int updateJb(Jbk jbk) {
        return this.jbkMapper.updateJb(jbk);
    }

    @Override
    public int deleteJb(String id) {
        return this.jbkMapper.deleteJb(id);
    }
}
